import React, { useState, useRef } from 'react';
import { PageContainer } from '@ant-design/pro-layout';
import ProTable from '@ant-design/pro-table';
import { Button, message, Modal } from 'antd';
import { queryOrder } from '@/services/ant-design-pro/apis';

const BizType = (props) => {
  const actionRef = useRef();
  const [selRows, setSelRows] = useState();
  const [createModalVisible, handleModalVisible] = useState(false);
  const [updateModalVisible, handleUpdteModalVisible] = useState(false);
  const [stepFormVals, setStepFormVals] = useState();
  const [exportModalVisible, handleExportModalVisible] = useState(false);
  const param = {};

  const columns = [
    {
      title: 'id',
      dataIndex: 'id',
      hideInSearch: true,
    },
    {
      title: '订单号',
      dataIndex: 'orderNum',
    },
    {
      title: '产品编号',
      dataIndex: 'productNum',
    },
    {
      title: '用户账号',
      dataIndex: 'openId',
      hideInSearch: true,
    },
    {
      title: '创建时间',
      dataIndex: 'creationTime',
      valueType: 'dateTime',
      hideInSearch: true,
    },
    {
      title: '收货地址',
      dataIndex: 'shipAddress',
      hideInSearch: true,
    },
    {
      title: '收货人',
      dataIndex: 'consignee',
      hideInSearch: true,
    },
    {
      title: '收货人电话',
      dataIndex: 'consigneePhone',
    },
    {
      title: '订单状态',
      dataIndex: 'status',
      valueEnum: {
        SUCCESS: {
          text: '成功',
          status: 'Success',
        },
        FAILED: {
          text: '失败',
          status: 'Error',
        },
        IN_PROCESS: {
          text: '充值中',
          status: 'Default',
        },
      },
    },
  ];

  return (
    <PageContainer>
      <ProTable
        columns={columns}
        actionRef={actionRef}
        params={param}
        headerTitle="订单列表"
        rowKey="id"
        request={queryOrder}
        rowSelection={{
          onChange: (_, selRows) => {
            setSelRows(selRows);
          },
        }}
        search={{
          defaultCollapsed: false,
        }}
      ></ProTable>
    </PageContainer>
  );
};

export default BizType;
